﻿<Window x:Class="TestAlbum.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Album Mazda3Quebec" Height="747" Width="1195" xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit" PreviewKeyDown="Window_PreviewKeyDown" Closing="Window_Closing" Loaded="Window_Loaded">
    <Grid Background="#FF494949">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>

            
            <Grid Grid.Column="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="5"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                    <ColumnDefinition Width="5"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="15"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="5"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                </Grid.RowDefinitions>

                <Grid Grid.Row="0" Grid.Column="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="5"></RowDefinition>
                        <RowDefinition Height="Auto"></RowDefinition>
                        <RowDefinition Height="5"></RowDefinition>
                    </Grid.RowDefinitions>

                    <Border Name="logoBorder" Grid.Row="1" Grid.Column="0" BorderThickness="0" BorderBrush="#FFAFAFAF"/>
                    <Image Grid.Row="1" Grid.Column="0" Name ="imgLogo" MaxWidth="150" HorizontalAlignment="Left" Stretch="None" VerticalAlignment="Center" Margin="5 5 5 5"/>
                    <Label Grid.Row="1" Grid.Column="1" Name="lblLogoText"  Foreground="#FFAFAFAF" FontSize="35" FontWeight="Bold"  HorizontalContentAlignment="Center" 
                           Focusable="False" VerticalContentAlignment="Center" VerticalAlignment="Center" Width="Auto" />

                </Grid>
                
                <Grid Grid.Row="1" Grid.Column="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"></RowDefinition>
                        <RowDefinition Height="Auto"></RowDefinition>
                        <RowDefinition Height="Auto"></RowDefinition>
                    </Grid.RowDefinitions>
                                        
                    <Border Grid.Row="0" Grid.RowSpan="3" Grid.Column="0" Grid.ColumnSpan="6" CornerRadius="5,5,5,5" BorderBrush="#FFAFAFAF" BorderThickness="2" />

                    <Border Grid.Row="1" Grid.RowSpan="2" Grid.Column="0" Grid.ColumnSpan="6" CornerRadius="0,0,5,5" BorderBrush="#FFAFAFAF" BorderThickness="2" />


                    <Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="6"  Width="Auto" Name="lblMainPictureMemberName"
                           FontSize="20" Foreground="#FFAFAFAF" FontWeight="Bold" HorizontalContentAlignment="Center"/>
                    
                    <Label Grid.Row="1" Grid.Column="0" Content="Année" HorizontalContentAlignment="Right" FontWeight="Bold" Foreground="#FFAFAFAF"
                           FontSize="13"/>
                    <Label Grid.Row="1" Grid.Column="1" Name="lblMainPictureYear" HorizontalContentAlignment="Left" Foreground="#FFAFAFAF"
                           FontSize="13"/>
                    <Label Grid.Row="1" Grid.Column="2" Content="Couleur" HorizontalContentAlignment="Right" FontWeight="Bold" Foreground="#FFAFAFAF"
                           FontSize="13"/>
                    <Label Grid.Row="1" Grid.Column="3" Name="lblMainPictureColor" HorizontalContentAlignment="Left" Foreground="#FFAFAFAF"
                           FontSize="13"/>
                    <Label Grid.Row="1" Grid.Column="4" Content="Ville" HorizontalContentAlignment="Right" FontWeight="Bold" Foreground="#FFAFAFAF"
                           FontSize="13"/>
                    <Label Grid.Row="1" Grid.Column="5" Name="lblMainPictureCity" HorizontalContentAlignment="Left" Foreground="#FFAFAFAF"
                           FontSize="13"/>
                    
                    <Label Grid.Row="2" Grid.Column="0" Content="Modifications" HorizontalAlignment="Right" FontWeight="Bold" Foreground="#FFAFAFAF"/>
                    <Label Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="5" Name ="lblMainPictureModifications" HorizontalContentAlignment="Left" Foreground="#FFAFAFAF"/>
                </Grid>
                
                <Grid Grid.Row="3" Grid.Column="1">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"></RowDefinition>
                    </Grid.RowDefinitions>

                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>

                    <Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" CornerRadius="5,5,5,5" BorderBrush="#FFAFAFAF" BorderThickness="2" />
                    <Border Grid.Row="0" Grid.Column="1" CornerRadius="0,0,0,0" BorderBrush="#FFAFAFAF" BorderThickness="2" />

                    <Image Grid.Row="0"  Grid.Column="1" Name="imgMainPicture" Margin="5 5 5 5"/>

                    <Image HorizontalAlignment="Left"  Name="imgPrevPic" Grid.Column="0" Source="/TestAlbum;component/Ressources/002_55.png" MouseUp="imgPrevPic_MouseUp" Stretch="None"></Image>
                    <Image HorizontalAlignment="Right" Name="imgNextPic" Grid.Column="2" Source="/TestAlbum;component/Ressources/002_56.png" MouseUp="imgNextPic_MouseUp" Stretch="None"></Image>
                                                
                </Grid>
                
                
                <Grid Grid.Row="5" Grid.Column="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                    </Grid.ColumnDefinitions>

                    <Border Grid.Column="0" Grid.ColumnSpan="3" CornerRadius="5,5,5,5" BorderBrush="#FFAFAFAF" BorderThickness="2" />
                    <Border Grid.Column="1" CornerRadius="0,0,0,0" BorderBrush="#FFAFAFAF" BorderThickness="2" />

                    <Image Name="imgPrevMember" Grid.Column="0" Source="/TestAlbum;component/Ressources/002_45.png" MouseUp="imgPrevMember_MouseUp" Stretch="None" Margin="0 2 0 2"></Image>
                    <Image Name="imgRdnMember" Grid.Column="1" Source="/TestAlbum;component/Ressources/002_55.png" MouseUp="imgRdnMember_MouseUp" Stretch="None" Margin="0 2 0 2"></Image>
                    <Image Name="imgNextMember" Grid.Column="2" Source="/TestAlbum;component/Ressources/002_46.png" MouseUp="imgNextMember_MouseUp" Stretch="None" Margin="0 2 0 2"></Image>
                </Grid>
                
                <Label Grid.Row="7" Grid.Column="1" Name="lblDBVersion" Content="DB Version : "  Foreground="#FFAFAFAF"/>
                
            </Grid>

            <Grid Grid.Column="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="25"></ColumnDefinition>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                    <ColumnDefinition Width="25"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                    <RowDefinition Height="25"></RowDefinition>
                </Grid.RowDefinitions>

                <Border Grid.Row="0" Grid.RowSpan="3" Grid.Column="0" Grid.ColumnSpan="3" CornerRadius="5,5,5,5" BorderBrush="#FFAFAFAF" 
                        BorderThickness="2" Margin="5 5 5 0"/>
                
                <Grid Grid.Row="0" Grid.Column="1" >

                    <Label Content="Liste des membres" FontSize="25" FontFamily="Arial" Foreground="#FFAFAFAF"  
                           HorizontalContentAlignment="Center" Margin="0 5 0 0" />
                    
                </Grid>
                
                
                <Grid Grid.Row="1" Grid.Column="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"></RowDefinition>
                        <RowDefinition Height="Auto"></RowDefinition>
                    </Grid.RowDefinitions>

                    <Label Grid.Row="0" Grid.Column="0"  Foreground="#FFAFAFAF" FontSize="13" FontWeight="Bold">Nom :</Label>
                    <TextBox Grid.Row="0" Grid.Column="1" Name="txtName" FontSize="13" TextChanged="txtName_TextChanged"></TextBox>
                    <Label Grid.Row="0" Grid.Column="2"  Foreground="#FFAFAFAF" FontSize="13" FontWeight="Bold">Année :</Label>
                    <TextBox Grid.Row="0" Grid.Column="3" Name="txtYear" FontSize="13" TextChanged="txtYear_TextChanged"></TextBox>
                    <Label Grid.Row="0" Grid.Column="4"  Foreground="#FFAFAFAF" FontSize="13" FontWeight="Bold">Ville :</Label>
                    <TextBox Grid.Row="0" Grid.Column="5" Name="txtCity" FontSize="13" TextChanged="txtCity_TextChanged"></TextBox>
                    
                    <CheckBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="6"  Name="chkOnlyFavorite" Content="Seulement les favoris"  FontSize="16" FontFamily="Arial" 
                              Foreground="#FFAFAFAF" Click="chkOnlyFavorite_Click" HorizontalContentAlignment="Right" Margin="0 5 0 0" 
                              HorizontalAlignment="Right" />
                </Grid>
                
                <my:DataGrid AutoGenerateColumns="False" Name="dgvMembers"
                             ItemsSource="{Binding}" Grid.Row="2"  Grid.Column="1" Background="#FF494949" SelectionChanged="dgvMembers_SelectionChanged" 
                             CanUserReorderColumns="False" IsReadOnly="True" Margin="0 10 0 5" VerticalGridLinesBrush="Transparent" 
                             GridLinesVisibility="None" BorderBrush="Transparent" >
                    <my:DataGrid.Columns>
                        <my:DataGridTextColumn Width="*" Binding="{Binding Path=Name}" Header="Nom" IsReadOnly="True"/>
                        <my:DataGridTextColumn Width="Auto" MinWidth="60" Binding="{Binding Path=Year}" Header="Année" IsReadOnly="True"/>
                        <my:DataGridTextColumn Width="Auto" MinWidth="60" Binding="{Binding Path=Color}" Header="Couleur" IsReadOnly="True"/>
                        <my:DataGridTextColumn Width="Auto" MinWidth="60" Binding="{Binding Path=City}" Header="Ville" IsReadOnly="True"/>
                        <my:DataGridTemplateColumn Header="Fav">
                            <my:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Image Width="20"  Source="{Binding Path=FavoritePicture}" />
                                </DataTemplate>
                            </my:DataGridTemplateColumn.CellTemplate>
                        </my:DataGridTemplateColumn>
                    </my:DataGrid.Columns>

                    <my:DataGrid.RowStyle>
                        <Style TargetType="{x:Type my:DataGridRow}">
                            <!-- <Setter Property="ToolTipService.ToolTip" Value="{StaticResource DGToolTip}"/> -->
                            <Setter Property="Background" Value="#FF494949" />
                        </Style>
                    </my:DataGrid.RowStyle>
                    
                    <my:DataGrid.RowHeaderStyle>
                        <Style  TargetType="my:DataGridRowHeader" >
                            <Setter Property="Width" Value="0" />
                        </Style>
                    </my:DataGrid.RowHeaderStyle>

                    <my:DataGrid.ColumnHeaderStyle>
                        <Style TargetType="{x:Type my:DataGridColumnHeader}">
                            <Setter Property="VerticalContentAlignment" Value="Center" />
                            <Setter Property="Background" Value="#FF494949" />
                            <!--<Setter Property="Foreground" Value="#FFAFAFAF" />-->
                            <Setter Property="Foreground" Value="Black" />
                            <Setter Property="Margin" Value="0 0 0 5"/>
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="my:DataGridColumnHeader">
                                        <my:DataGridHeaderBorder
                                            x:Name="headerBorder"                      
                                            Background="#FF494949">
                                            <Border 
                                                BorderThickness="2" 
                                                CornerRadius="5,5,5,5" 
                                                Background="#D8D8D8"
                                                BorderBrush="#6B6B6B">
                                                <Grid>
                                                    <TextBlock Text="{TemplateBinding  Content}" 
                                                               VerticalAlignment="Center" 
                                                               HorizontalAlignment="Center" 
                                                               TextWrapping="Wrap"
                                                               FontSize="14" 
                                                               FontWeight="Bold"
                                                               Margin="2 2 2 2"/>
                                                </Grid>
                                            </Border>
                                        </my:DataGridHeaderBorder>

                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </my:DataGrid.ColumnHeaderStyle>
                    
                    <my:DataGrid.RowDetailsTemplate>
                        <DataTemplate>
                            <Grid Margin="0" Background="#FF494949">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                
                                <Border Grid.Row="0" Grid.RowSpan="3" Grid.Column="0" Grid.ColumnSpan="3" BorderBrush="#FFAFAFAF" BorderThickness="2"
                                        CornerRadius="5 5 5 5" Margin="2 2 2 2"/>
                                
                                <Label Content="Modifications :" FontWeight="Bold" FontSize="11" Grid.Row="0" Grid.Column="0" Foreground="#FFAFAFAF" 
                                       HorizontalContentAlignment="Right" Margin="0 10 15 5"/>
                                <Label Content="{Binding ModificationStringFormatted}" FontSize="11" Grid.Row="0" Grid.Column="1" Foreground="#FFAFAFAF" 
                                       HorizontalContentAlignment="Left" Margin="0 10 15 5"/>

                                <Grid Grid.Row="0" Grid.Column="2">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>

                                    <CheckBox Grid.Column="0"  Name="chkFavoriteSelected" Foreground="#FFAFAFAF" FontSize="11" 
                                            HorizontalAlignment="Right" VerticalAlignment="Center" IsChecked="{Binding Mode=OneWay, 
                                            Path=FavoriteBool}"  Click="chkFavoriteSelected_Click" Margin="0 10 15 5"/>
                                    <Image Grid.Column="1" Source="/TestAlbum;component/Ressources/onebit_43.png" Width="20" Stretch="Uniform"
                                           HorizontalAlignment="Left" Margin="0 0 15 0"/>

                                </Grid>
                                
                                <Grid Grid.Row="2" Grid.ColumnSpan="3">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>

                                    <Image Grid.Column="0" Source="{Binding ImgToolTip1}" Width="150" Margin="0 0 0 5"/>
                                    <Image Grid.Column="1" Source="{Binding ImgToolTip2}" Width="150" Margin="0 0 0 5"/>
                                    <Image Grid.Column="2" Source="{Binding ImgToolTip3}" Width="150" Margin="0 0 0 5"/>
                                </Grid>
                            </Grid>
                        </DataTemplate>
                    </my:DataGrid.RowDetailsTemplate>
                    
                    <my:DataGrid.CellStyle>
                        <Style TargetType="{x:Type my:DataGridCell}">
                            <Setter Property="Background" Value="#FF494949" />
                            <Setter Property="FontSize" Value="12" />
                            <Setter Property="Foreground" Value="White" />
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type my:DataGridCell}">
                                        <Border Name="CellBorder"  
                                                BorderThickness="1" 
                                                CornerRadius="5,5,5,5" 
                                                Background="#FF494949"
                                                BorderBrush="#FFAFAFAF"
                                                SnapsToDevicePixels="True">
                                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
                                                              HorizontalAlignment="Center" VerticalAlignment="Center"/>
                                        </Border>
                                        <ControlTemplate.Triggers>
                                            <Trigger Property="IsSelected" Value="True">
                                                <Setter TargetName="CellBorder" Property="Background" Value="#C0C0C0" />
                                                <Setter Property="Foreground" Value="Black" />
                                            </Trigger>
                                        </ControlTemplate.Triggers>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>                            
                        </Style>
                    </my:DataGrid.CellStyle>
                    
                </my:DataGrid>

                <Label VerticalAlignment="Bottom"  Grid.Row="5" Grid.Column="1"  Content="v0.5 - Créé par Mugs - 2010" HorizontalAlignment="Right" FontSize="10" FontFamily="Garamond" Foreground="#FFAFAFAF" />
           </Grid>
        </Grid>
    </Grid>
</Window>
